macos: move drag motion to GdkMacosDrag
authorChristian Hergert <chergert@redhat.com>
Thu, 17 Jun 2021 20:24:39 +0000 (13:24 -0700)
committerChristian Hergert <chergert@redhat.com>
Thu, 17 Jun 2021 20:24:39 +0000 (13:24 -0700)
This doesn't help to be pushed off into the surface, as it makes things
more different than the X11 implementation.

gdk/macos/gdkmacosdrag.c
gdk/macos/gdkmacosdragsurface-private.h
gdk/macos/gdkmacosdragsurface.c

index c89b01948fb32e40b55d04c2d9725b5037115e78..ee4b5e7020990a08d4f4448726b5ea87b5a270ba 100644 (file)
@@ -326,12 +326,10 @@ gdk_drag_update (GdkDrag         *drag,
                                 &suggested_action,
                                 &possible_actions);
 
-  _gdk_macos_drag_surface_drag_motion (self->drag_surface,
-                                       x_root - self->hot_x,
-                                       y_root - self->hot_y,
-                                       suggested_action,
-                                       possible_actions,
-                                       evtime);
+  if (GDK_IS_MACOS_SURFACE (self->drag_surface))
+    _gdk_macos_surface_move (GDK_MACOS_SURFACE (self->drag_surface),
+                             x_root - self->hot_x,
+                             y_root - self->hot_y);
 
   if (!self->did_update)
     {
@@ -339,6 +337,8 @@ gdk_drag_update (GdkDrag         *drag,
       self->start_y = self->last_y;
       self->did_update = TRUE;
     }
+
+  gdk_drag_set_actions (drag, possible_actions);
 }
 
 static gboolean
index cf7408f3087570fde328c75f399a3d0ecf8a8a21..bc84e3d30f9e8e1c547aa186390a1ee340ccd040 100644 (file)
@@ -31,19 +31,13 @@ typedef struct _GdkMacosDragSurfaceClass GdkMacosDragSurfaceClass;
 #define GDK_MACOS_DRAG_SURFACE(object)    (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MACOS_DRAG_SURFACE, GdkMacosDragSurface))
 #define GDK_IS_MACOS_DRAG_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_DRAG_SURFACE))
 
-GType            _gdk_macos_drag_surface_get_type    (void);
-GdkMacosSurface *_gdk_macos_drag_surface_new         (GdkMacosDisplay *display,
-                                                      GdkFrameClock   *frame_clock,
-                                                      int              x,
-                                                      int              y,
-                                                      int              width,
-                                                      int              height);
-void             _gdk_macos_drag_surface_drag_motion (GdkMacosDragSurface *self,
-                                                      int                  x_root,
-                                                      int                  y_root,
-                                                      GdkDragAction        suggested_action,
-                                                      GdkDragAction        possible_actions,
-                                                      guint32              evtime);
+GType            _gdk_macos_drag_surface_get_type (void);
+GdkMacosSurface *_gdk_macos_drag_surface_new      (GdkMacosDisplay *display,
+                                                   GdkFrameClock   *frame_clock,
+                                                   int              x,
+                                                   int              y,
+                                                   int              width,
+                                                   int              height);
 
 G_END_DECLS
 
index 2b035836040deabdd7c8243b541fdf8a16847231..dd6d5e520ebd8f948f7e61287d2e000a5195312d 100644 (file)
@@ -123,16 +123,3 @@ _gdk_macos_drag_surface_new (GdkMacosDisplay *display,
 
   return g_steal_pointer (&self);
 }
-
-void
-_gdk_macos_drag_surface_drag_motion (GdkMacosDragSurface *self,
-                                     int                  x_root,
-                                     int                  y_root,
-                                     GdkDragAction        suggested_action,
-                                     GdkDragAction        possible_actions,
-                                     guint32              evtime)
-{
-  g_return_if_fail (GDK_IS_MACOS_DRAG_SURFACE (self));
-
-  _gdk_macos_surface_move (GDK_MACOS_SURFACE (self), x_root, y_root);
-}